// --------------------------------------------------------------------------------------------------------------------
// <copyright file="FooWorkItem.cs" company="AzureContrib (Open source library http://azurecontrib.codeplex.com)">
//   Microsoft Public License (Ms-PL)
// </copyright>
// <summary>
//   Defines the FooWorkItem type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System.ComponentModel.Composition;
using AzureContrib.WindowsAzure.Diagnostics;
using AzureContrib.WindowsAzure.WorkServices;

namespace AzureContrib.WindowsAzure.TestWorkerRole
{
	[WorkItemMetadata(1, WorkType.Run, WorkItems.FirstWorkItemName, "The first one.")]
	public class FooWorkItem : IWorkItem
	{
		private readonly ITrace trace;

		[ImportingConstructor]
		public FooWorkItem(ITraceFactory traceFactory)
		{
			trace = traceFactory.Create(GetType());
		}

		public bool HasWork
		{
			get { return true; }
		}

		public void DoWork()
		{
			trace.Verbose("Verbose trace");
			trace.Information("Information trace");
			trace.Warning("Warning trace");
			trace.Error("Error trace");
		}
	}
}